package com.llc.spring.cloud.gateway.zuul.util;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.nio.charset.Charset;

/**
 * time 2018/6/22 17:00
 *
 * @author xiaojie.zhu <br>
 */
public class ExceptionUtil {

    public static final Charset UTF8 = Charset.forName("UTF-8");

    public static String toString(Throwable e){
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(out));

        String str = new String(out.toByteArray(), UTF8);
        return str;
    }


}
